<!doctype html>
<html>
<head>
<script src="/blue/js/jquery.js"></script>
<link href="/blue/css/css.css" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="format-detection" content="telephone=no" />
<meta charset="utf-8">
<title>蓝色保洁地址用户选择</title>
<style>
/*address地址*/
.address{ height:78px; padding-left:4%; padding-right:4%; position:relative; margin-top:14px; background-color:#fff; padding-top:9px; box-sizing:border-box}
.address h1{ font-size:14px; line-height:21px; color:#191919;}
.address h2{ font-size:14px;  color:#65646b;}
.address h3{ font-size:14px; line-height:18px; color:#b2bab8;}
.address p{line-height:41px; position:absolute; right:4%; top:0; background-image:url(/blue/images/block.png); background-size:13px 13px; background-position:left center; background-repeat:no-repeat; padding-left:20px;}
.delete{ width:20%; height:74px; line-height:74px; background-color:#c40000; color:white; font-size:18px; text-align:center; position:absolute; top:0; right:0}
</style>
</head>

<body style="background-color: #f9f9f9;">
<!--header顶部标题-->
<div class="header">服务地址
	<div class="header_left"  onclick="window.history.go(-1)"><img src="/blue/images/return.png"></div>
    <div class="header_right" id="edit" onClick="onedit()">编辑</div>
</div>
<!--address地址-->
@foreach($cha as $a)

    <div class="address" id="{{$a->id}}" onclick="chuan(this.id)">
        <span style="display: none">{{$li}}</span>
        <div class="border_top"></div>
            <h1>{{$a->community}}</h1>
            <h2>联系人：<span>{{$a->contact}}</span>&nbsp;&nbsp;&nbsp;&nbsp;电话：<span>{{$a->tel}}</span></h2>
            <h2>地址：<span>{{$a->address}}</span></h2>
            <div class="delete" id="{{$a->id}}" onclick="del(this.id)">删除</div>
        <div class="border_bottom"></div>
    </div>
@endforeach
<!--column添加新地址-->
<div class="column_box" style="margin-top:14px;" onclick="document.location='address_add';">
	<div class="border_top"></div>
	<div class="column_img"><img src="/blue/images/add.png"></div>
    <p>添加新地址</p>
    <div class="next"><img src="/blue/images/arrow.png"></div>
    <div class="border_bottom"></div>
</div>
<script>
$(".delete").hide();
function onedit(){
	var a=document.getElementById('edit').innerText;
	if(a=="编辑"){
		$(".delete").show();
		document.getElementById('edit').innerText="取消"
		}else if(a=="取消"){
			$(".delete").hide();
			document.getElementById('edit').innerText="编辑"
			}
	}

function del(id) {
    $.get('delete_community',{'id':id},function (res) {
        if(res == 0){
            alert('删除成功');
            location.href="address?ii=ri";
        }else{
            alert('删除失败');
        }
    });
}

function chuan(id) {
    var a = $('#'+id).find('span').eq(0).text();
   if(a == 'ri'){
       location.href="cleaning_index?id="+id;
   }else if(a == 'hu'){
       location.href="floor?fuwu=<?php echo $fuwu?>&id="+id ;
   }

}
</script>
</body>
</html>

